package cc.yugu.yhdw.common.domain.hdw;

import cc.yugu.yhdw.common.entity.json.DateTimeSerializer;
import org.codehaus.jackson.map.annotate.JsonSerialize;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * 箱子
 */
public class CabinetBox {

    public enum BoxStatus {
        EMPTY(1, "空箱"),
        FULL(2, "满箱"),
        BESPEAK(3, "预约"),
        OCCUPY(4, "占用"),;

        private final int value;
        private final String name;

        private BoxStatus(int value, String name) {
            this.value = value;
            this.name = name;
        }

        private static Map<Integer, String> map = new HashMap<Integer, String>();

        static {
            for (BoxStatus e : BoxStatus.values()) {
                map.put(e.getValue(), e.getName());
            }
        }

        public static String getName(int value) {
            return map.get(value);
        }

        public int getValue() {
            return value;
        }

        public String getName() {
            return name;
        }
    }

    String cabinetId; //终端ID
    String boxNum;//箱号
    Integer activeFlag; //是否启用
    Integer boxStatus; //状态
    String batteryId;
    Integer batteryVolume; //电池电量
    Integer chargeStage; //
    Integer occupyCustomerId;
    Date refreshTime; //电量刷新时间
    Date occupyTime;

    String oldBoxNum, boxStatusName;
    Integer temp;

    public Integer getTemp() {
        return temp;
    }

    public void setTemp(Integer temp) {
        this.temp = temp;
    }

    @JsonSerialize(using = DateTimeSerializer.class)
    public Date getOccupyTime() {
        return occupyTime;
    }

    public void setOccupyTime(Date occupyTime) {
        this.occupyTime = occupyTime;
    }

    public void setBoxStatusName(String boxStatusName) {
        this.boxStatusName = boxStatusName;
    }

    public String getCabinetId() {
        return cabinetId;
    }

    public void setCabinetId(String cabinetId) {
        this.cabinetId = cabinetId;
    }

    public String getBoxNum() {
        return boxNum;
    }

    public void setBoxNum(String boxNum) {
        this.boxNum = boxNum;
    }

    public Integer getActiveFlag() {
        return activeFlag;
    }

    public void setActiveFlag(Integer activeFlag) {
        this.activeFlag = activeFlag;
    }

    public Integer getBoxStatus() {
        return boxStatus;
    }

    public void setBoxStatus(Integer boxStatus) {
        this.boxStatus = boxStatus;
    }

    public String getBatteryId() {
        return batteryId;
    }

    public void setBatteryId(String batteryId) {
        this.batteryId = batteryId;
    }

    public Integer getBatteryVolume() {
        return batteryVolume;
    }

    public void setBatteryVolume(Integer batteryVolume) {
        this.batteryVolume = batteryVolume;
    }

    public Integer getChargeStage() {
        return chargeStage;
    }

    public void setChargeStage(Integer chargeStage) {
        this.chargeStage = chargeStage;
    }

    @JsonSerialize(using = DateTimeSerializer.class)
    public Date getRefreshTime() {
        return refreshTime;
    }

    public void setRefreshTime(Date refreshTime) {
        this.refreshTime = refreshTime;
    }

    public String getOldBoxNum() {
        return oldBoxNum;
    }

    public void setOldBoxNum(String oldBoxNum) {
        this.oldBoxNum = oldBoxNum;
    }

    public Integer getOccupyCustomerId() {
        return occupyCustomerId;
    }

    public void setOccupyCustomerId(Integer occupyCustomerId) {
        this.occupyCustomerId = occupyCustomerId;
    }

    public String getBoxStatusName() {
        if (boxStatus != null) {
            return BoxStatus.getName(boxStatus);
        }
        return "";
    }
}
